DUO.COM is an illustration of a dedicated operation multitasking program written in ZBASIC. DUO.BAS is simply a multitasking "shell" providing time slices to the executing code within each Task Section ... plus providing flow control when either task is completed and termination when both are completed.
The code within each task can be anything the programmer imagines ... though care obviously must be taken in use of variable names conflicting between tasks (until comfortable one might want to append a -1 to all variables in task 1 and a -2 in task 2). DUOTASK.BAS and DUOTASK1.BAS are advanced, practical examples of this concept.
In the example each task is terminated with a keypress, leaving the other task running until it is terminated by another keypress. Thus when both tasks are running the screen will read :
TASK1 Executing
TASK2 Executing
TASK1 Executing
TASK2 Executing
TASK1 Executing
TASK2 Executing
TASK1 Executing
TASK2 Executing
TASK1 Executing
TASK2 Executing
TASK1 Executing
TASK2 Executing
TASK1 Executing
TASK2 Executing
then after a keypress
TASK1 Executing
TASK1 Executing
TASK1 Executing
TASK1 Executing
TASK1 Executing
TASK1 Executing
TASK1 Executing
TASK1 Executing
TASK1 Executing
TASK1 Executing
(or TASK2 only)
This indicates that one task is closed and only the other is executing. The second keypress terminates the entire process.
DUODEMO.BAS includes a windowing version showing the executing sections in their own windows.